< previous page page_482 next page >

Page 482
Now enter the code from Listing 21.21 into the Form_Resize event. This is the code that sizes and places the list and command buttons on the dialog box.
Type.gifListing 12.21. Coding the Form_Resize event.
Private Sub Form_Resize()
    '
    With DBList1
        .Left = 1
        .Top = 1
        .Width = Me.ScaleWidth
        .Height = Me.ScaleHeight - (300 + 90 + 90)
    End With
    '
    With Command1(0)
        .Left = 120
        .Top = Me.ScaleHeight - (390)
        .Height = 300
        .Width = Me.ScaleWidth * 0.45
        .Caption = "OK"
        .Default = True
    End With
    '
    With Command1(1)
        .Left = Me.ScaleWidth * 0.5
        .Top = Command1(0).Top
        .Height = Command1(0).Height
        .Width = Command1(0).Width
        .Caption = "Cancel"
        .Cancel = True
    End With
    '
End Sub
Now it's time to write the code for the Command1_Click event. This is the code that executes when the user presses a command button. Add the code from Listing 12.22 to your form.
Type.gifListing 12.22. Coding the Command1_Click event.
Private Sub Command1_Click(Index As Integer)
    '
    ' handle user button selection
    '
    Select Case Index
        Case 0 ' OK
            CloseFlag = True
            varSelectValue = frmFind.DBList1.BoundText
        Case 1 ' cancel
            CloseFlag = False
    End Select

 
< previous page page_482 next page >

If you like this book, buy it!